<?php

class My_Request extends Database{

    public function setQuery($form_tablename,$id,$search_value){
      $auth = Auth::getAuth('current_user');
      $userID = $auth['id'];
      $query_str = "(SELECT form.DateCreated as DateCreated, form.TrackNo as TrackNo,form.id as request_id, u.first_name,u.last_name,u.middle_name, form.Status as form_status,
                    form.Requestor as requestor_id, form.Processor as processors_id, tbw.form_name, tbw.id as form_id 
                    FROM `$form_tablename` form LEFT JOIN tbuser u ON u.id=form.requestor, tb_workspace tbw
                    WHERE form.requestor = '$userID' AND tbw.id = $id AND (tbw.form_name LIKE '%". $search_value ."%' OR form.TrackNo LIKE '%". $search_value ."%' OR form.Status LIKE '%". $search_value ."%') ORDER BY form.id DESC) ";
      return $query_str;                    
    }
}

?>